#include "myrobot.h"

myRobot::myRobot()
{
    pressed = false;


}

QRectF myRobot::boundingRect() const
{
    return QRectF(-150,-200,300,400);
}

void myRobot::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{

    QRectF rec = boundingRect();

    QPen qpen(Qt::black);
    QBrush qbrush(Qt::red);

    qpen.setWidth(5);

    painter->setPen(qpen);
    painter->setBrush(qbrush);

    QRectF rec_elli = QRectF(-150,-200,300,400);
    painter->drawEllipse(rec_elli);
    QPointF p1 = QPointF(0,-200);
    QPointF p2 = QPointF(0,-75);

    qpen.setWidth(18);

    painter->setPen(qpen);

    painter->drawLine(p1,p2);

}

void myRobot::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
    pressed = true;
    update();
    QGraphicsItem::mousePressEvent(event);
}

void myRobot::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
    pressed = false;
    update();
    QGraphicsItem::mouseReleaseEvent(event);
}
